{extend name="public/base"}

{block name="title"}
我要收款
{/block}

{block name="style"}
{css href="/static/wechat/css/distribution.css" /}
<style>
    .repair_name {
        text-align: center;
        line-height: 3rem;
        margin-top: 2rem;
        font-size: 1rem;
        color: #666;
    }
    .fendiv {
        margin-top: 0;
        height: auto;
    }
    .erweima {
        position: inherit;
        top:0;
    }
    .text{
        margin: 1rem auto 3rem;
        text-align: center;
        color: #666;
    }
    .save_text {
        font-size: .7rem;
    }
</style>
{/block}
{block name="body"}
<div class="pageControl orderDetails" style="background: #fff;">
    <div class="msui_nav msui_navTop" style="border-bottom: 1px solid #cccccc;align-items: center;background: #FFC800; color: #fff;">
        <a class="msui_navTop-back" href="javascript:history.back();"><i class="micon-back"></i></a>
        <h1 class="msui_navTop-title">我的收款码</h1>
    </div>

    <p class="repair_name">{$repair.repair_name}</p>
    <div class="fendiv">
        <div class="erweima">
            <img src="/uploads/{$repair.gathering_qr_code}" style="width: 100%; height: 100%;" />
        </div>
    </div>
    <p class="text">让顾客扫一扫，向我付款</p>

    <a href="javascript:;" class="weui-btn weui-btn_default create_gathering_img" style="margin:auto; width: 80%; background: #FFC800; color: #fff">保存到手机</a>
    <p class="text save_text">保存二维码，打印后张贴在门店方便顾客付款</p>
</div>

<div id="loadingToast" style="display:none;">
    <div class="weui-mask_transparent"></div>
    <div class="weui-toast">
        <i class="weui-loading weui-icon_toast"></i>
        <p class="weui-toast__content">数据加载中...</p>
    </div>
</div>

{/block}
{block name="javascript"}
<script>
    $(function () {
        $(".create_gathering_img").click(function () {
            $('#loadingToast').show();
            var id = '{$repair.id}';
            var repair_name = '{$repair.repair_name}';
            var img = '{$repair.gathering_qr_code}';
            $.get('{:url("create_gathering_img")}', {id: id, repair_name: repair_name, img: img}, function (msg) {
                if (msg.code == 200) {
                    window.location.href = '{:url("gathering_img")}?img=' + msg.path;
                }
            }, 'json');
        });
    });
</script>
{/block}
